package com.silvtar.sync.ui;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import java.awt.BorderLayout;
import java.awt.Dimension;

public class TerminalPanel extends JPanel {

    JTextArea textArea;

    /**
     * Create the panel.
     */
    public TerminalPanel() {
        setPreferredSize(new Dimension(400, 400));
        setLayout(new BorderLayout(0, 0));

        JScrollPane scrollPane = new JScrollPane();
        add(scrollPane, BorderLayout.CENTER);

        textArea = new JTextArea();
        textArea.setText(" Terminal: Waiting\n");
        scrollPane.setViewportView(textArea);
    }

    public void println(String string) {
        textArea.append(" " + string + "\n");
    }

    public void println() {
        textArea.append("\n");
    }

    public void clear() {
        textArea.setText("");
    }

}
